﻿namespace Alkitab
{
    using Alkitab.Language;
    using Microsoft.Phone.Controls;
    using System.Collections.Generic;
    using System.Windows;
    using System.Windows.Controls;

    public partial class UkuranFont : PhoneApplicationPage
    {
        #region Fields

        private List<int> temp = new List<int>();

        #endregion Fields

        #region Constructors

        public UkuranFont()
        {
            InitializeComponent();
            loremipsum.FontSize = (int)Globals.Settingan["fontsize?"];
            informasi.Text = returnTextCurrentFontSize();
            for (int i = 15; i <= 40; i++)
            {
                temp.Add(i);
            }
            fontSize.ItemsSource = temp;
            if ((((int)Globals.Settingan["fontsize?"]) >= 15) & (((int)Globals.Settingan["fontsize?"]) <= 40)) fontSize.SelectedIndex = (int)Globals.Settingan["fontsize?"] - 15;
            fontSize.ScrollIntoView(fontSize.SelectedItem);
        }

        #endregion Constructors

        #region Methods

        private void fontSize_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            if (!(fontSize.SelectedIndex == -1)) Globals.Settingan["fontsize?"] = fontSize.SelectedItem;
            loremipsum.FontSize = (int)Globals.Settingan["fontsize?"];
            informasi.Text = returnTextCurrentFontSize();
        }

        private string returnTextCurrentFontSize()
        {
            return (Labels.currentFontSize + (int)Globals.Settingan["fontsize?"]);
        }

        private void standard_Click(object sender, RoutedEventArgs e)
        {
            Globals.Settingan["fontsize?"] = 23;
            fontSize.SelectedIndex = (int)Globals.Settingan["fontsize?"] - 15;
            fontSize.ScrollIntoView(fontSize.SelectedItem);
            MessageBox.Show(Labels.MSG_StandardFontSize);
        }

        #endregion Methods
    }
}